<template>
	<view class="app" v-show="show">

		<view class="card" style="height: auto;margin: 20rpx;background: rgba(30, 41, 59, 0.8);z-index: 99999;">
			<view class="list" v-for="(item,index) in selectedAirportList" :key="index" @click.stop="toPage(item.url)">
				<image src="/static/icon-images/bars.png" mode="widthFix"></image>
				<view class="text">{{item.text}}</view>
			</view>
		</view>

		<putPopup :show.sync="putShow"></putPopup>

	</view>
</template>

<script>
	import putPopup from '@/pages/market/components/putPopup/index.vue'
	export default {
		components: {
			putPopup
		},
		props: {
			show: {
				type: Boolean,
				default: false
			},
			type: {
				type: Number,
				default: 0
			}
		},
		data() {
			return {
				putShow: false,
				indexList: [{
					url: '',
					icon: '/static/icon-images/bars.png',
					text: '首页'
				}, {
					url: '',
					icon: '/static/icon-images/bars.png',
					text: '机场'
				}, {
					url: '',
					icon: '/static/icon-images/bars.png',
					text: '游戏'
				}, {
					url: '',
					icon: '/static/icon-images/bars.png',
					text: '市场'
				}, {
					url: '',
					icon: '/static/icon-images/bars.png',
					text: '我的'
				}],
				airportList: [{
					url: '/pages/airport/fit',
					icon: '/static/icon-images/bars.png',
					text: '合成'
				}, {
					url: '/pages/market/rules?type=1',
					icon: '/static/icon-images/bars.png',
					text: '规则'
				}],
				marketList: [{
					url: 'putaway',
					icon: '/static/icon-images/bars.png',
					text: '求购'
				}, {
					url: '/pages/market/rules?type=2',
					icon: '/static/icon-images/bars.png',
					text: '规则'
				}, {
					url: '/pages/market/marketNodes',
					icon: '/static/icon-images/bars.png',
					text: '记录'
				}],
				gameList: [{
					url: '/pages/market/rules',
					icon: '/static/icon-images/bars.png',
					text: '规则'
				}],
				myList: [{
					url: '/pages/my/transNodes',
					icon: '/static/icon-images/bars.png',
					text: '流水记录'
				}, {
					url: '/pages/my/giftNodes',
					icon: '/static/icon-images/bars.png',
					text: '转赠记录'
				}, {
					url: '/pages/my/hcNodes',
					icon: '/static/icon-images/bars.png',
					text: '合成记录'
				}, {
					url: '/pages/my/djNodes',
					icon: '/static/icon-images/bars.png',
					text: '道具记录'
				}, {
					url: '/pages/my/kqNodes',
					icon: '/static/icon-images/bars.png',
					text: '卡券记录'
				}],

			};
		},
		computed: {
			selectedAirportList() {
				switch (this.type) {
					case 1:
						return this.indexList;
					case 2:
						return this.airportList;
					case 3:
						return this.marketList;
					case 4:
						return this.gameList;
					case 5:
						return this.myList;
					default:
						return [];
				}
			}
		},
		methods: {
			toPage(url) {
				if (url == 'putaway') {
					this.putShow = true
					return
				}
				if (url) {
					uni.navigateTo({
						url: url
					})
					this.$emit('update:show', false)
				} else {
					uni.showToast({
						icon: 'none',
						title: '暂未开放'
					})

				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.app {
		position: absolute;
		z-index: 999999;
		display: block;
		width: 100%;
	}

	.list {
		padding: 20rpx 30rpx;
		display: flex;
		align-items: center;

		image {
			display: block;
			width: 40rpx;
			height: 40rpx;
			margin-right: 20rpx;
		}

		.text {
			font-size: 32rpx;
			font-weight: 600;
			color: #D1D5D8;
			line-height: 1;
		}
	}
</style>